<?php
$this->menu = array(
    array('label' => 'Print', 'url' => array('cargo_export/report', 'id' => $model->id, 'print' => 'print'), 'linkOptions' => array('id' => 'menu_print'))
);
?>
<?php foreach ($model->search()->getData() as $data): ?>
<?php $this->beginWidget('application.widgets.report.makeReport'); ?>
    <div class="report">
        <table class="header" width="100%">
            <tr>
                <th>
                    <center><u>Subsidiary export certificate</u></center>
                </th>
            </tr>
        </table>
        <p>
        <table class="content" width="100%">
            <tr>
                <th width="150px">
    			Our Marking / Ref:
                </th>
                <td>
<?php echo $data->cargo->marking; ?>
            </td>
        </tr>
    </table>
</p>
<p>
<table class="content showline" width="100%">
    <tr>
        <td>
            <p>
                <b>Exporter:</b>
    <section style="margin:-10px 0px 20px 20px;">
<?php echo CHtml::label(nl2br($data->exporter), 'exporter'); ?>
    </section>
    </p>
    </td>
    </tr>
    <tr>
        <td>
            <p>
                <b>Consignee:</b>
    <section style="margin:-10px 0px 20px 20px;">
<?php echo CHtml::label(nl2br($data->consignee), 'consignee'); ?>
    </section>
    </p>
    </td>
    </tr>
</table>
</p>
<p>
<table class="content showline" width="100%" style="text-align:left;">
    <tr height="30">
        <th width="130">Outward Permit No.</th>
        <td width="170"><?php echo CHtml::label($data->export->out_permit, 'permit'); ?></td>
        <th width="130">ETD</th>
        <td width="170"><?php echo CHtml::label(Yii::app()->format->formatDate($data->export->etd), 'etd'); ?></td>
    </tr>
    <tr height="30">
        <th>AWB No./B/L No.</th>
        <td><?php echo CHtml::label($data->export->awb, 'awb'); ?></td>
        <th>Mode of Transport </th>
        <td><?php echo CHtml::label($data->export->mode, 'mode'); ?></td>
    </tr>
    <tr height="30">
        <th>Vessel / Flt </th>
        <td><?php echo CHtml::label($data->export->vessel, 'vessel'); ?></td>
        <th>Total Value </th>
        <td>S$ <?php echo CHtml::label(Yii::app()->format->formatNumber($data->cargo->amt), 'amt'); ?></td>
    </tr>
</table>
</p>
<p>
<table class="content showline" width="100%">
    <tr height="40">
        <td>
            <p>
                <b>Exporter Ref:</b>
                <br />
<?php echo CHtml::label($data->exporter_ref, 'exporter_ref', array('style' => 'margin:0px 0px 20px 20px;')); ?>
            </p>
        </td>
    </tr>
    <tr height="120">
        <td>
            <p>
                <b>Remark</b>
                <br />
<?php echo CHtml::label($data->remark, 'remark', array('style' => 'margin:0px 0px 20px 20px;')); ?>
            </p>
        </td>
    </tr>
</table>
</p>
<p>
	*This is a computer generated document.
</p>
</div>
<?php $this->endWidget(); ?>
<?php endforeach; ?>
<?php
    $script = <<<EOD
$('#menu_print').click(function(){
	$.simplelogajax.popup($(this).attr('href'));
	return false;
});
EOD;
    $cs = Yii::app()->getClientScript();
    $cs->registerScript('cargo_export#report', $script);
?>